# Maintainer: Felix Huettner <huettner94@gmx.de>

pkgname=whois
pkgver=5.5.5
pkgrel=1
pkgdesc="The whois client by Marco d'Itri"
arch=('i686' 'x86_64')
url="https://www.linux.it/~md/software/"
license=('GPL')
depends=('libcrypt' 'libidn2' 'libiconv')
makedepends=('perl' 'libcrypt-devel' 'libidn2-devel' 'libiconv-devel')
backup=('etc/whois.conf')
source=("http://ftp.debian.org/debian/pool/main/w/whois/${pkgname}_${pkgver}.tar.xz"
        "whois-libiconv.patch")
sha256sums=('c30e8a444482eadac157be42649833ef77c5ea9fb5cbcbabb6ee3f2254e5530d'
            '15635fe62da7eed833ad0b1c124fc8e4647f06c7e5b6b5b3314b32a663899ce6')

prepare() {
  cd "${srcdir}/${pkgname}"
  patch -i ${srcdir}/whois-libiconv.patch
}

build() {
  cd "${srcdir}/${pkgname}"

  make prefix=/usr \
       CFLAGS="$CFLAGS $CPPFLAGS" \
       CONFIG_FILE=/etc/whois.conf \
       HAVE_LIBIDN2=1 \
       HAVE_ICONV=1
}

package() {
  cd "${srcdir}/${pkgname}"

  make prefix=/usr BASEDIR="${pkgdir}" install-whois
  install -D -m644 whois.conf "${pkgdir}/etc/whois.conf"
}
